//
//  AMIOAudioSampleFile.h
//  RunSketch
//
//  Created by Brian on 10/18/09. Based heavily on work by Aran Mulholland in Feb. 2009. See also: http://sites.google.com/site/iphonecoreaudiodevelopment/
//  From Aran's fantastic site at http://sites.google.com/site/iphonecoreaudiodevelopment/:
//
//       "ive been hacking away at the iphone audio stuff
//       for some time now, i've been to the mailing lists,
//       ive been to the documentation. and finally ive decided
//       to collect some code samples and post them here so
//       others won't have to go through the same headaches
//       i have (and still am). i am eagerly waiting for
//       the book Core Audio (Core Frameworks Series) i've
//       even pre-ordered it from amazon. if your into this
//       stuff you should probably do the same, but while you wait...."
//
//  Modifications copyright 2009 Tellart. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioFile.h>
#include <sys/time.h>


@interface AMIOAudioSampleFile : NSObject {
	AudioStreamBasicDescription		mDataFormat;                    
    AudioFileID						mAudioFile;                     
    UInt32							bufferByteSize;                 
    SInt64							mCurrentPacket;                 
    UInt32							mNumPacketsToRead;              
    AudioStreamPacketDescription	*mPacketDescs;                  
	SInt64							packetCount;
	UInt32							*audioData;
	SInt64							packetIndex;
}

//opens a wav file
-(OSStatus)open:(NSString *)filePath;
//gets the infor about a wav file, stores it locally
-(OSStatus)getFileInfo;

//gets the next packet from the buffer, returns -1 if we have reached the end of the buffer
-(UInt32)getNextPacket;

//gets the current index (where we are up to in the buffer)
-(SInt64)getIndex;

//reset the index to the start of the file
-(void)reset;

@end
